/**
 * 
 */
package com.example.radioclub.podcast;

import java.sql.Array;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;

import org.w3c.dom.Text;

import com.example.radioclub.R;
import com.example.radioclub.types.PodcastContent;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.SimpleAdapter;
import android.widget.TextView;

/**
 * This is supposed to be adapter for podcast content.
 * 
 * @author wizard
 * 
 */
public class PodcastAdapter extends SimpleAdapter {
	private Context context;
	private ArrayList<PodcastContent> array;

	public PodcastAdapter(Context context, String podcastJson) {
		super(context, null, 0, new String[] {}, new int[] {});
		// TODO Auto-generated constructor stub
		this.context = context;
	}

	public PodcastAdapter(Context context, ArrayList<PodcastContent> array) {
		super(context, null, 0, new String[] {}, new int[] {});
		// TODO Auto-generated constructor stub
		this.context = context;
		this.array = array;
	}

	@Override
	public int getCount() {
		// TODO Auto-generated method stub
		return this.array.size();
	}

	@Override
	public Object getItem(int position) {
		// TODO Auto-generated method stub
		return this.array.get(position);
	}

	@Override
	public View getView(int position, View convertView, ViewGroup parent) {
		// TODO Auto-generated method stub
		PodcastContent podcast = this.array.get(position);
		View view = LayoutInflater.from(context).inflate(
				R.layout.podcast_layout, null);
		TextView podcastContentName = (TextView) view
				.findViewById(R.id.podcast_content_name);
		podcastContentName.setText(podcast.getPodcastName());

		return view;
	}
}
